public class quickSort {

        public static void quickSort(int[] elem){
            Sort(elem,0,elem.length-1);
        }
        public static void Sort(int[] elem, int left,int right){
            if (left >= right){
                return;
            }
            int par = seekpar(elem,left,right);

            Sort(elem,left,par-1);

            Sort(elem,par+1,right);

        }
        public static int seekpar(int[] elem,int left,int right){
            int low = left;
            int high = right;
            int cur = elem[left];
            while (low < high){

                while (elem[high] >= elem[left] && low < high){
                    high--;
                }
                elem[low] = elem[high];

                while (elem[low] <= elem[left] && low < high){
                    low++;
                }
                elem[high] = elem[low];
            }
            elem[low] = cur;
            return low;
        }

        public static void swap(int[] array,int i,int j){
            int cur = array[i];
            array[i] = array[j];
            array[j] = cur;
        }

}
